@extends('layouts.admin')
@section('css')
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_page.css') }}" rel="stylesheet" />
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_table.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-datepicker/css/datepicker.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-daterangepicker/daterangepicker-bs3.css') }}" rel="stylesheet">
@endsection
@section('content')
<section id="main-content">
          <section class="wrapper">
            <div class="panel-body right"  align="right">          
                    <form class="form-inline" action="{{ route('admin.statistics.summary') }}" role="form" method="get">
                          {{ csrf_field() }}
                          
                          <div class="form-group">
                              <label class="sr-only" for="exampleInputEmail2">用户名</label>
                              <input type="text" class="form-control tooltips" id="name" data-toggle="tooltip" name="name" value="{{ $data['name'] }}" placeholder="输入用户名">
                          </div>
                          <div class="form-group">
                              <label class="sr-only" for="exampleInputPassword2">电话</label>
                              <input type="text" class="form-control" id="mobile" name="mobile" value="{{ $data['mobile'] }}" placeholder="输入手机">
                          </div>
                          <div class="form-group "  >
                                <input type="text" class="form-control dpd1 default-date-picker" name="from" value="{{ $data['from'] }}" placeholder="开始日期">
                          </div>
                          -
                          <div class="form-group "  >
                                    <input type="text" class="form-control dpd2 default-date-picker" name="to" value="{{ $data['to'] }}" placeholder="截止日期">
                          </div>
                          <button type="submit" class="btn btn-info">搜索</button>
                      </form>

            </div>
              <!--state overview start-->
              <div class="row state-overview">
                  <div class="col-lg-3 col-sm-6">
                      <section class="panel">
                          <div class="symbol terques">
                              <i class="icon-user"></i>
                          </div>
                          <div class="value">
                              <h1 class="count">
                                {{ $users_count }}
                              </h1>
                              <p>用户</p>
                          </div>
                      </section>
                  </div>
                  <div class="col-lg-3 col-sm-6">
                      <section class="panel">
                          <div class="symbol red">
                              <i class="icon-tags"></i>
                          </div>
                          <div class="value">
                              <h1 class=" count2">
                                  {{ $total_balance }}
                              </h1>
                              <p>总余额</p>
                          </div>
                      </section>
                  </div>
                  <div class="col-lg-3 col-sm-6">
                      <section class="panel">
                          <div class="symbol yellow">
                              <i class="icon-shopping-cart"></i>
                          </div>
                          <div class="value">
                              <h1 class=" count3">
                                  {{ $orders_count }}
                              </h1>
                              <p>总单数</p>
                          </div>
                      </section>
                  </div>
                  <div class="col-lg-3 col-sm-6">
                      <section class="panel">
                          <div class="symbol blue">
                              <i class="icon-bar-chart"></i>
                          </div>
                          <div class="value">
                              <h1 class=" count4">
                                  {{ $total_profit }}
                              </h1>
                              <p>总收入</p>
                          </div>
                      </section>
                  </div>
              </div>
            <!-- invoice start-->
            

              <section>
                  <div class="panel panel-primary">
                      <!--<div class="panel-heading navyblue"> INVOICE</div>-->
                      <div class="panel-body">
                          
                          <table class="table table-striped table-hover">
                              <thead>
                              <tr>
                                  <th>#</th>
                                  <th>产品</th>
                                  <th class="">单数</th>
                                  <th class="">保证金总额</th>
                                  <th class="">综合费用总额</th>
                                  <th class="">用户盈利</th>
                                  <th class="">用户亏损</th>
                                  <th>收入</th>
                              </tr>
                              </thead>
                              <tbody>
                              @foreach($options as $option)
                              <tr>
                                  <td>{{ $option->id }}</td>
                                  <td>{{ $option->name }}</td>
                                  <td>{{ $option->orders_count }}</td>
                                  <td class="">{{ $option->total_margin }}</td>
                                  <td class="">{{ $option->total_cost }}</td>
                                  <td class="">{{ $option->total_earn }}</td>
                                  <td>{{ $option->total_loss }}</td>
                                  <td>{{ $option->total_profit }}</td>
                              </tr>
                              @endforeach
                              </tbody>
                          </table>
                          <div class="row">
                              <div class="col-lg-4 invoice-block pull-right">
                                  <ul class="unstyled amounts">
                                      <li><strong>纯收入(综合费用+收入) :</strong> ￥{{ $total_transaction_cost+$total_profit }} </li>
                                      <li><strong>充值总额 :</strong> ￥{{ $total_rechages }} <strong>(手续费总额 :</strong> ￥{{ $total_rechages*0.009 }})</li>
                                      <li><strong>提现总额 :</strong> ￥{{ $total_withdrawals }} <strong>(手续费总额 :</strong> ￥{{ $total_withdrawals_fee }})</li>
                                      <li><strong>佣金总额 :</strong> ￥{{ $commissions }} </li>
                                  </ul>
                              </div>
                          </div>
                          
                      </div>
                  </div>
              </section>
              <!-- invoice end-->
          </section>
      </section>
@endsection
@section('javascript')
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/advanced-datatable/media/js/jquery.dataTables.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/assets/bootstrap-datepicker/js/bootstrap-datepicker.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/assets/bootstrap-daterangepicker/daterangepicker.js') }}"></script>

<script src="{{ asset('admin/js/advanced-form-components.js') }}"></script>
<script type="text/javascript" charset="utf-8">
    var users_count = {{ $users_count }};
    var total_balance = {{ $total_balance }};
    var orders_count = {{ $orders_count }};
    var total_profit = {{ $total_profit }};
</script>
<!-- <script src="{{ asset('admin/js/count.js') }}"></script>   -->
@endsection

